﻿<Grid KeyDown="Root_KeyUp" Loaded="Root_Loaded" Focusable="True" KeyboardNavigation.DirectionalNavigation="Local" Name="Root" x:Class="VRacer.Controls.GameBoard"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:VRacer.Controls"
    xmlns:model="clr-namespace:VRacer;assembly=VRacer"
      xmlns:bonus="clr-namespace:VRacer.Bonus;assembly=VRacer"
        >

    <Grid.Resources>
        <DataTemplate DataType="{x:Type model:PlayerBase}">
            <controls:GBPlayerPath Player="{Binding}" />
        </DataTemplate>
        
        <DataTemplate DataType="{x:Type bonus:SpeedUpBonus}">
            <Image Source="../Icons/battery_charging_00a0.png" Width="16" />
        </DataTemplate>
        
        <DataTemplate DataType="{x:Type bonus:SpeedDownBonus}">
            <Image Source="../Icons/battery_charging_00a0.png" Width="16" />
        </DataTemplate>
        
        <DataTemplate DataType="{x:Type bonus:MovesUpBonus}">
            <Image Source="../Icons/battery_charging_00a0.png" Width="16" />
        </DataTemplate>
        
        <DataTemplate DataType="{x:Type bonus:MovesDownBonus}">
            <Image Source="../Icons/battery_charging_00a0.png" Width="16" />
        </DataTemplate>
    </Grid.Resources>

    <Grid.Background>
        <ImageBrush Opacity="0.5" Stretch="Fill" ImageSource="{Binding ElementName=Root,Path=Game.CurrentTrack.Mask}" />
    </Grid.Background>

    <Image HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Source="{Binding ElementName=Root,Path=Game.CurrentTrack.Background}" Stretch="Fill" />

    <controls:BonusLayer HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding ElementName=Root,Path=Game.Bonuses}">
        <controls:BonusLayer.ItemsPanel>
            <ItemsPanelTemplate>
                <Canvas />
            </ItemsPanelTemplate>
        </controls:BonusLayer.ItemsPanel>
    </controls:BonusLayer>

    <ItemsControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding ElementName=Root,Path=Game.Players}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <Canvas />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>

    <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

        <Ellipse Canvas.Top="30" Canvas.Left="50" x:Name="cursor" Fill="Blue" Opacity="0.5" Width="10" Height="10" Margin="-5" />

    </Canvas>
</Grid>
